using System;
using Microsoft.SPOT;
using Gadgeteer.Interfaces.Fakes.Properties;

namespace Gadgeteer.Interfaces.Fakes.Framework
{
    public class PictureBuilder
    {
        private Resources.BinaryResources[] images = new[]
        {
            Resources.BinaryResources.Image_01,
            Resources.BinaryResources.Image_02,
        };

        private int index = 0;

        private int GetNextIndex()
        {
            index++;
            if (index >= images.Length)
                index = 0;

            return index;
        }

        public Picture NextPicture()
        {
            var rawPicData = Resources.GetBytes(images[GetNextIndex()]);
            var picture = new Picture(rawPicData, Picture.PictureEncoding.BMP);

            return picture;
        }
    }
}
